home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Delphi Magazine Collection 2001
/
Delphi Magazine Collection 20001 (2001).iso
/
DISKS
/
ISSUE09
/
CLINIC
/
SLISTBOX.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1996-02-18
|
1KB
|
50 lines
unit Slistbox;
interface
uses
Messages, Classes, Controls, StdCtrls;
type
TScrollEvent = procedure(Sender: TObject; ScrollCode, Pos: Word) of object;
TSListbox = class(TListBox)
private
FOnScroll: TScrollEvent;
FOnSelChange: TNotifyEvent;
protected
procedure WMVScroll(var Msg: TWMVScroll);
message wm_VScroll;
procedure CNCommand(var Msg: TWMCommand);
message cn_Command;
published
property OnScroll: TScrollEvent read FOnScroll write FOnScroll;
property OnSelChange: TNotifyEvent read FOnSelChange write FOnSelChange;
end;
procedure Register;
implementation
procedure TSListbox.WMVScroll(var Msg: TWMVScroll);
begin
inherited;
if Assigned(FOnScroll) then
FOnScroll(Self, Msg.ScrollCode, Msg.Pos);
end;
procedure TSListBox.CNCommand(var Msg: TWMCommand);
begin
inherited;
if (Msg.NotifyCode = lbn_SelChange) and
Assigned(FOnSelChange) then
FOnSelChange(Self);
end;
procedure Register;
begin
RegisterComponents('Samples', [TSListbox]);
end;
end.